// JavaScript Document
//jquery.resource.management

$(function(){
	//search function
$("#searchtxt").focus(function(){
	if($(this).val() == "search..."){
		$(this).val("");
	}
}).blur(function(){
	if($(this).val() == ""){
		$(this).val("search...");
	}
});
var all_search = $('input#searchtxt').quicksearch('table tbody tr:visible',
		{   
			//selector: 'table tbody tr:visible',
			onBefore: function(){
				$('table tbody tr:hidden').css("display","none");
			},
			show: function () {
				this.style.display = "";
			},
			hide: function () {
				this.style.display = "none";
			}
	    });
	
	
	
	
	
	
	//accepted_offer alert messagebox
//var $okk;
//$okk=$(".accepted_offer").popup();


//rejected_offer alert messagebox
$(".accepted_offer").popup({num:0});
$(".rejected_offer").popup({num:1});
$(".delete").popup({num:2});
$('.recall').popup({num:0});
	
	

//expand the details of offer

$("#tr1").toggle(
	 	function(){
	 		
	 		$("#tr1d").css("display","");
			$('.tab_details :input').attr("disabled","disabled");
	 	},
	 	function(){
	 		$("#tr1d").css("display","none");
	 	}
	 
	 );

	

	
	//make the input &area to be grey  in add_internal_information 
	$(".bi_tr1").attr("disabled","true");
	$(".disable").attr("disabled","true");
	
	
	
	//add interview in create_new_step2.html
	var index = $(".tab_interview").length + 1;
	var tab = '<table  class="tab_interview"   width="100%">' + $(".tab_interview").html() + '</table>';
	$(".plus_clone").click(
		function(){
			var i = "<label>Interview" + index + ":</label>";
			$(".ftf_interview").append(i + tab);
			index = $(".tab_interview").length + 1;
		}
		
	);
	
	//add other test in create_new_step2.html
	
	$(".plus_ot").click(
		function(){
			$(".td_text").append("<div style='margin:10px 0 -5px 0;'>" + $(".inner_text").html() + "<span class='minus'>-</span></div>");
		}
	);
	
	$('.minus').live('click',function(){
		
		$(this).parent().remove();
	});
	
	var approveform = $(".form");
	approveform.hide();
	$('.leave tr:gt(0)').not($('.form')).click(function(){
		approveform.hide();
		$(this).after(approveform.show());
	})
	
$('.accordion .approve').popup({num:1});
$('.accordion .reject').popup({num:0});

$('.la').change(function(){
	location.href = $(this).attr('value');
})

//team_attendance, aprovel_request aprove reject popup
	
});

	

